<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册界面</title>
<link rel="stylesheet" href="../static/css/xadmin.css">
    <link rel="stylesheet" href="../static/css/xadmin.css">
	<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="../static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../static/js/xadmin.js"></script>
    <script src="../static/js/my.js"></script>
</head>
<body   background="../../../../target/classes/static/images/3.jpg">
<div class="login">
    <div class="message layui-bg-orange">用户注册</div>
    <div id="darkbannerwrap"></div>

    <form class="layui-form">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>登录名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userName" name="userName" required="" lay-verify="userName" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_pass" class="layui-form-label">
                <span class="x-red">*</span>密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_pass" name="userPwd" required="" lay-verify="pass" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
                <span class="x-red">*</span>确认密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_repass" name="surePwd" required="" lay-verify="repass" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label"></label>
            <button  class="layui-btn layui-btn-radius layui-btn-warm" lay-filter="add" lay-submit="">确认注册</button>
        </div>
        <span id="i" style="color:red"></span>
    </form>
</div>
<!---->
</body>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            userName: function(value){
                if(value.length < 3){
                    return '昵称至少得3个字符啊';
                }
            }
            ,pass: [/(.+){3,10}$/, '密码必须3到10位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });

        //注册
        form.on('submit(add)', function(data){
			console.log("开始调用Request");
            $.ajax({
                url:address+"/Sanyecao_Zhuce/zhuceRequst",
                type:"post",
                data:data.field,
                dataType:"json",//返回的数据类型
                success:function(d){
                    //定义{info:"登录成功"}
                   $("#i").text(d.info);
                    //如果注册成功就跳转到登录页面
                    if(d.info=="注册成功"){
                        console.log(d.info);
                        //这里插一句跳转到登录界面
                        //这里插一句跳转到登录界面
                        //这里插一句跳转到登录界面
                        //这里插一句跳转到登录界面
                        alert("注册成功,点击确认返回登录界面");
                        window.location.href="login.html";
                    }
                }
            })
            return false;
        });


    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>
